$(function() {
	$("#uploadify").uploadify({
		'uploader' : 'jsUpload/uploadify.swf',
		'script' : 'fileUpload',//?id='+id+'&pId='+pid+'&fileId='+fileId+'&reportType='+reportType,
		'cancelImg' : 'jsUpload/images/cancel.png',
		'folder' : 'uploads',
		'fileDataName':'file',//上传框name
		'auto' : false,
		'multi' : true,
		'simUploadLimit' : 2,
		'queueID' : 'fileQueue',
		'fileDesc' : '请选择PDF文件',
		'fileExt' : '*.pdf;*.swf',
		'sizeLimit' : 5 * 1024 * 1024,
		//'height' : 34,
		//'width' : 110,
		//'buttonImg' : '/pages/js/jsUpload/images/brows.png',
		//'buttonText':'阿什顿',
		'wmode' : 'transparent',
		onComplete : function(event, queueID, fileObj, response,data) {
			$("#info").append(response+"<br>");
		},
		onError : function(event, queueID, fileObj, errorObj) {
			//alert(errorObj.info);
			if ('File Size' == errorObj.type) {
				$.messager.alert('提示', '上传的文件不能大于5M，上传失败!', 'error');
			};
		},onAllComplete:function(event, uploadObj){
			alert("成功上传："+uploadObj.filesUploaded+"，失败数："+uploadObj.errors);
		},onSelect  : function(event,data){
			$("#info").html("");
		}
	});
	//getMenu();
});

function submit(){
	if($("#fileQueue").html()==""){
		$.messager.alert('提示','请先选择需要上传的文件','info');
		return false;
	}
	var value = $("#hid_value").val();
	if(value==""){
		$.messager.alert('提示','请先选择上传的文件夹','info');
		return false;
	}
	var id = value.split(":")[0];
	var name = value.split(":")[1];
	$.messager.confirm('确认上传', '上传到<'+name+'>文件夹', function(r){
		if (r){
			var user_id = $("#user_id").val();
			//alert('fileUpload?idstrd='+id+'&user_id='+user_id);
			var url = 'fileUpload?idstrd='+id+'&user_id='+user_id;
			//alert(url);
			$('#uploadify').uploadifySettings('script',url);
			$('#uploadify').uploadifyUpload();
		}
	});
}


function getMenu(){
	$.ajax({
	   type: "POST",
	   url: "getMenu",
	   // data:{'name':encodeURI(encodeURI(time+"已预约报表"))},
	   cache:false,
	   success: function(msg){
		   $("#tt1").html(msg);
	   }
	});
}
function checked(id){
	$("#hid_value").val(id+":"+$("#"+id).html());
}
